﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using ApiConceptsFramework.Contract;
using ApiConceptsFramework.FluentApi;
using NUnit.Framework;

namespace test.ApiConceptsFramework.FluentApi.Scenarios.OtherStudies
{
	[TestFixture, Explicit]
	class RequiredCtorParams
	{
		private Assembly[] _assemblies;
		private string[] _usings;
		private ApiEvaluator _eval;

		#region Setup
		[SetUp]
		public void SetUp()
		{
			_assemblies = new Assembly[] { this.GetType().Assembly };
			_usings = new string[] {};

			_eval = new ApiEvaluator(_assemblies);
			_eval.IDE = IDE.VisualStudioOrSimilar;
			_eval.SetUsings(_usings);
			_eval.SetAssemblyRefs(_assemblies);
		}

		[TearDown]
		public void TearDown()
		{
			_eval.EvaluateAndPrintToConsole();
		}
		#endregion


		[Test]
		public void EmailTask_RequiredCtor()
		{
			int prevUsages = 3;

			//_eval.ClassUsage<Email>(previousUsages: prevUsages);
			_eval.Instantiation(() => new Email(null, null, null, null), previousUsages: prevUsages);
		}

		[Test]
		public void EmailTask_CreateSetCall()
		{
			int prevUsages = 3;

			//_eval.ClassUsage<Email>(previousUsages: prevUsages);
			_eval.Instantiation(() => new Email(), previousUsages: prevUsages);
			_eval.PropertyAccess((Email m) => m.From, previousUsages: prevUsages);
			_eval.PropertyAccess((Email m) => m.To, previousUsages: prevUsages);
			_eval.PropertyAccess((Email m) => m.Subject, previousUsages: prevUsages);
			_eval.PropertyAccess((Email m) => m.Text, previousUsages: prevUsages);
		}
		
		class Email
		{
			public Email()
			{
			}

			public Email(string from, string to, string subject, string text)
			{
			}

			public string From { get; set; }
			public string To { get; set; }
			public string Subject { get; set; }
			public string Text { get; set; }
		}
	}
}
